package online.hxstart.code.concurrent.chapter06;

import java.util.concurrent.TimeUnit;

/**
 * @author huxing
 * @date 19-5-31 星期五 下午4:36
 * @describe
 */
public class ThreadGroupEnumerateThreadGroups {

  public static void main(String[] args) throws InterruptedException {
    //
    ThreadGroup myGRoup1 = new ThreadGroup("myGroup1");
    ThreadGroup myGroup2 = new ThreadGroup(myGRoup1, "myGroup2");

    TimeUnit.MILLISECONDS.sleep(2);
    ThreadGroup mainGroup = Thread.currentThread().getThreadGroup();

    ThreadGroup[] list = new ThreadGroup[mainGroup.activeGroupCount()];
    int recurseSize = mainGroup.enumerate(list);
    System.out.println(recurseSize);

    recurseSize = mainGroup.enumerate(list, false);
    System.out.println(recurseSize);
  }
}
